import bayes
from numpy import *
import re
import feedparser

listOposts, listClasses = bayes.loadDataSet()
myVocabList = bayes.createVocabList(listOposts)
# print(myVocabList)
# print(bayes.setOfWords2Vec(myVocabList, listOposts[0]))

# trainMat = []
# for posinDoc in listOposts:
   #  trainMat.append(bayes.setOfWords2Vec(myVocabList, posinDoc))

# p0V, p1V, pAb = bayes.trainNB0(trainMat, listClasses)
# print(p0V)
# print(p1V)

# bayes.testingNB()

# 得到email文件夹中的词汇
# regEx = re.compile('\\w*')
# emailText = open('./email/ham/6.txt').read()
# listOfTokens = regEx.split(emailText)

# bayes.spamTest()

ny = feedparser.parse('http://newyork.craigslist.org/stp/index.rss')

print(len(ny['entries']))

